package com.jadows.tdog.message.handler.pipline.impl;

import com.jadows.tdog.domain.ChatMessage;
import com.jadows.tdog.message.handler.pipline.IMessageProcess;
import com.jadows.tdog.properties.ChatMessageProperties;
import io.netty.channel.Channel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * @author taojiacheng
 */
@Service("messageTicketVerifyProcess")
@Slf4j
@RequiredArgsConstructor
public class MessageTicketVerifyProcess implements IMessageProcess {

    final ChatMessageProperties chatMessageProperties;


    /**
     * 优惠券校验处理
     *
     * @param message 消息
     * @return 消息
     */
    @Override
    public ChatMessage handlerMessage(ChatMessage message, Channel channel) {
        if (!chatMessageProperties.isCheckTicket()) {
            log.info("未开启聊天券校验:{}", message);
            return message;
        }
        log.info("优惠券校验处理:{}", message);
        return message;
    }
}
